require 'rake'
require_relative 'sinatra_helpers/sinatra_app'
require_relative 'sinatra_helpers/bootstrap_app'

namespace :sinatra do
  SINATRA_PUBLIC = "public/"
  SINATRA_VIEWS  = "views/"
  task :create_dirs do
    mkdir_p SINATRA_PUBLIC
    mkdir_p SINATRA_VIEWS
  end
  task :delete_dirs do
    rm_rf SINATRA_PUBLIC
    rm_rf SINATRA_VIEWS
  end
  desc "Create Sinatra files and directories"
  task :init => [:delete_dirs, :create_dirs]
  desc "Boostrap + JQuery skeleton"
  task :bootstrap => :init do
    Rake::Task["bootstrap:install"].invoke
    Rake::Task["jquery:install"].invoke
    Rake::Task["assets:link"].invoke('../assets/jquery.js', './public/')
    Rake::Task["assets:link"].reenable
    Rake::Task["assets:link"].invoke('../assets/bootstrap', './public/')
    SinatraHelpers::BootstrapApp.invoke
    puts "Created skeleton"
  end
  desc "ExtJS skeleton"
  task :extjs => :init do
    Rake::Task["extjs:install"].invoke
    Rake::Task["jquery:install"].invoke
    Rake::Task["assets:link"].invoke('../assets/jquery.js', './public/')
  end
end
